﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="maxhttp2qvod.aspx.cs" Inherits="MMYY.Web.maxhttp2qvod" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>MAXCMS---扩展工具</title>
    <link type="text/css"  rel="Stylesheet" href="images/admin.css" />
    <script type="text/javascript">
        var $ = function(obj){return document.getElementById(obj);}
        function doEvent(){
            var sDiyName = $("txtDiyName").value;
            var bUsed = $("chk").checked?"1":"0";
            var geturl = "maxHttp2QvodAjax.aspx?a=getids&r="+Math.random();
            var sre = '';
            var ajax1 = createXMLHTTP();
            ajax1.open("GET",geturl,true);
            ajax1.onreadystatechange = function(){
                if(ajax1.readyState==4){
                    if(ajax1.status==200){
                        sre=ajax1.responseText;ajax1 = null;
                        var ids = new Array(); ids = sre.split('|');
                        for(var i=0;i<ids.length;i++){
                            var url = "maxHttp2QvodAjax.aspx?i="+ids[i]+"&sRe="+sDiyName+"&b="+bUsed+"&r="+Math.random();
                            var ajax = createXMLHTTP();
                            ajax.open("GET",url,true);
                            ajax.onreadystatechange = function(){
//                                //alert(ajax.readyState);
                                if(ajax.readyState==4){
                                    if(ajax.status==200){
                                         $("divResult").innerHTML = $("divResult").innerHTML + ajax.responseText;
                                         ajax = null;
                                    }
                                }
                            }
                            ajax.send(null);
                       }
                    }
                }
            }
            ajax1.send(null);
            
        }
        
        function getNum(){
            var url = "maxHttp2QvodAjax.aspx?a=getnum&r="+Math.random();
            var xmlhttp = createXMLHTTP();
            xmlhttp.open("GET",url,true);
            xmlhttp.onreadystatechange = function(){
                if(xmlhttp.readyState==4){
                    if(xmlhttp.status==200){
                        $("lnum").innerHTML=xmlhttp.responseText;
                        xmlhttp = null;
                    }
                }
            }
            xmlhttp.send(null);
        }
        function createXMLHTTP(){
            var xmlhttp = null;
            if(window.XMLHttpRequest){
                xmlhttp = new XMLHttpRequest();
            }else if(window.ActiveXObject){
                try{
                    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                }catch(e){
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
            }
            return xmlhttp;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div><br />
        <h5 style="text-align:center">HTTP 转 QVOD</h5>
        自定义文件名：<input type="text" value="[38film.com]" id="txtDiyName" runat="server" />  <input type="checkbox"  checked="checked"  id="chk" />使用 <br />
        数据库中是HTTP地址的记录数：(<label id="lnum"></label> ) &nbsp;&nbsp;<input type="button" value="获取记录数" onclick="getNum()" /><br />
        <input type="button" value=" 开 始 转 换 " onclick="doEvent()" />
        <div id="divResult" style="BORDER-RIGHT: #111111 0px solid; BORDER-TOP: #111111 1px solid; FONT-SIZE: 10pt; OVERFLOW: scroll; BORDER-LEFT: #111111 0px solid; WIDTH: 100%; BORDER-BOTTOM: #111111 0px solid; HEIGHT: 400px"></div>        
    </div>
    </form>
</body>
</html>
